
**********************************
** Programs that need to be installed:

** amoeba - see net describe sg71, from(http://www.stata.com/stb/stb38)


capture: cd "~\Dropbox\imls\replication\"

global datapath = "data"
global dopath = "dofiles"
global figpath = "output\figures"
global tablepath = "output\tables"


capture: mkdir output 
capture: mkdir output\figures
capture: mkdir output\tables

capture: mkdir $datapath\intermediate
capture: mkdir $datapath\clean
capture: mkdir $datapath\temp



***************************************
** Data creation

** main data
	do "$dopath\create_maindata.do" 

** FIPS place demographics
	do "$dopath\create_age_place.do"
	do "$dopath\create_income_place.do"
***************************************

	
***************************************
** Summary stats	
	
** Figure 1:
	do "$dopath\fig1_library_visit_time_series.do"
	
** Table 1:
	do "$dopath\table1_summary_stats.do"
***************************************



***************************************
** Descriptive analysis

** Tables 2 and 3:
	do "$dopath\table2_causal_demand_FE.do"
	do "$dopath\table3_causal_demand_IV.do"

** Table 4:
	do "$dopath\table4_causal_visits.do"

***************************************



***************************************
** Estimation & counterfactuals 

** Table 5 - logit estimates:
	do "$dopath\table5_logit_demand.do"


** Table 6 - main counterfactuals:
	do "$dopath\setup_t6_counterfactual_main.do" 
	do "$dopath\table6_counterfactual_main.do"


** Figure 2 - heterogeneity:
	do "$dopath\setup_f2_counterfactual_income.do"
	do "$dopath\setup_f2_counterfactual_kids.do" 
	do "$dopath\fig2_counterfactual_heterogeneity.do"

***************************************



***************************************
** Numbers in the text

** Section 3.1 - calculating library staff costs
	do "$dopath\text_s31_staffing_costs.do"

** Section 4.1 & 4.2 - standard errors around causal theta: 
	do "$dopath\text_s41_causal_theta_se.do" 
	
** Section 5.4: distribution of thetas
	do "$dopath\text_s54_calculate_thetas.do"
	
** Section 6.1 - CS effects by library manager ebook preference	
	do "$dopath\text_s61_counterfactual_details.do"

** Section 6.2 - Robustness - including staffing costs in prices: 
	do "$dopath\setup_text_s62_counterfactual_staff.do"
	do "$dopath\text_s62_counterfactual_staff.do"
	
** Section 6.2 - Robustness - different sigma values: 
	do "$dopath\setup_text_s62_counterfactual_sigma.do" 
	do "$dopath\text_s62_counterfactual_sigma.do"

	
** Footnote 23 - share of books among all holdings: 
	do "$dopath\text_fn23_bookshares.do"

** Footnote 27 - thetas for different income levels:
	do "$dopath\text_fn27_theta_income.do" 

** Footnote 30 - visits decline attributable to ebooks:
	do "$dopath\text_fn30_visits_decline.do"

	

***************************************

	
	
	
	